package leetcode.code0232;

import java.util.Stack;

public class MyQueue1 {

	private Stack<Integer> s1;
	private Stack<Integer> s2;

	public MyQueue1() {
		s1 = new Stack<>();// s1 队
		s2 = new Stack<>();
	}

	public void push(int x) {
		while (!s1.isEmpty()) {
			s2.add(s1.pop());
		}
		s2.add(x);
		while (!s2.isEmpty()) {
			s1.add(s2.pop());
		}
	}

	public int pop() {
		return s1.pop();
	}

	public int peek() {
		return s1.peek();
	}

	public boolean empty() {
		return s1.isEmpty();
	}

}
